#include "junix.h"

long jsleep;

void sig_alarm(int signo)
{
	if(signo==SIGALRM)
	{
		printf("sleep %ld sec\n",jsleep);
	}
}
int main(int argc, char **argv)
{
	if(argc==1)
	{
		fprintf(stderr,"Usage:%s intger\n",argv[0]);
		exit(EXIT_FAILURE);
	}	
	jsleep=strtol(argv[1],NULL,10);

	if(signal(SIGALRM,sig_alarm)==SIG_ERR)
		err_sys("signal");

	alarm(jsleep);
	pause();
	return 0;
}

